<?php
//水印*********************

//目标图(大图)****************
$dstImg = imagecreatefromjpeg('./shanghai.jpg');
$dstH = imagesy($dstImg);
$dstW = imagesx($dstImg);

//源图(小图)
$srcImg = imagecreatefrompng('./logo.png');
$srcH = imagesy($srcImg);
$srcW = imagesx($srcImg);

//(目标图Y位置)=(大图高度-小图的高度-一些高度)
$dstY = $dstH - $srcH - 10;
$dstX = $dstW - $srcW - 50;
//($dst_im, $src_im, $dst_x, $dst_y, $src_x, $src_y, $src_w, $src_h)
//imagecopy($dstImg,$srcImg,$dstX,$dstY,0,0,$srcW,$srcH);
//($dst_im, $src_im, $dst_x, $dst_y, $src_x, $src_y, $src_w, $src_h, $pct)
imagecopymerge($dstImg,$srcImg,$dstX,$dstY,0,0,$srcW,$srcH,30);
//另存图片
imagejpeg($dstImg,'./shanghai_water.jpg');
//销毁
imagedestroy($dstImg);
imagedestroy($srcImg);








